package com.itheima.app.controller;

import com.itheima.app.manager.TestSoulManager;
import com.itheima.domain.db.Answers;
import com.itheima.vo.ReportVo;
import com.itheima.vo.TestSoulVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * java
 */
@RestController
public class TestSoulController {

    @Autowired
    private TestSoulManager testSoulManager;

    //查询测灵魂问卷列表
    @GetMapping("/testSoul")
    public List<TestSoulVo> findSoulQuestionList() {

        return testSoulManager.findSoulQuestionList();
    }

    //测灵魂问卷提交
    @PostMapping("/testSoul")
    public String saveSoulQuestion(@RequestBody Map<String, List<Answers>> map) {

        return testSoulManager.saveSoulQuestion(map);

    }

    //测灵魂查看结果
    @GetMapping("/testSoul/report/{id}")
    public ReportVo findResult(@PathVariable Integer id) {

        return testSoulManager.findResult(id);
    }


}
